package com.common;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class GlobalSetting {

    /**
     * Logger for this class
     */
    private static final Log log = LogFactory.getLog(GlobalSetting.class);
    private static Properties globalSetting = null;
    

    static {

        InputStream is = GlobalSetting.class.getClassLoader().getResourceAsStream("/globalSetting.properties");
        Properties pro = new Properties();

        try {
            pro.load(is);
        } catch (IOException e) {
            log.error("load file globalSetting.properties error", e);
        }
        globalSetting = pro;

    }

    /**
     * get globalSetting.properties
     * 
     * @param key
     * @return
     */
    public static String getProperty(String key) {
        log.debug("Fetching property [" + key + "=" + globalSetting.getProperty(key) + "]");
        return globalSetting.getProperty(key);
    }
}
